#!/bin/bash

##行数不为0，即进程存在
if [ $(netstat -anp | grep 9094 | grep -v "grep" | wc -l) -ne 0 ]; then
  ##只过滤包含关键字LISTEN的（因为包含ESTABLISHED和WAIT状态），截取出进程号并kill掉
  kill -9 $(netstat -anp | grep 9094 | grep "LISTEN" | awk '{print $7}' | awk -F"/" '{print $1}')
  echo "stop success and killed! "
else
  echo "stop success!"
fi
nohup java -jar comp-common-nginx-gui-1.0-SNAPSHOT.jar &
